-
Notifications
You must be signed in to change notification settings - Fork 0
feat: branch protection hooks (v2.16.0) #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement deterministic branch protection via PreToolUse hook that prevents destructive edits on protected branches, addressing advisory CLAUDE.md rules failing under reasoning pressure. Hook: ~/.claude/hooks/branch-guard.sh (~290 lines) - main = block-all (no edits, writes, or commits) - dev = block-new-code (new code files blocked, fixups/md/tests OK) - feature/* = unrestricted - Per-project config via .claude/branch-guard.json - Auto-detect repos with dev branch - Session-scoped bypass with reason logging New commands: /craft:git:unprotect, /craft:git:protect Enhanced: /craft:check, /craft:do, /craft:git:worktree, /craft:git:status Tests: 42 unit (bash) + 6 integration (python), all passing Performance: ~60ms/invocation (under 100ms target) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The branch-guard.sh hook previously lived at ~/.claude/hooks/ outside version control. Now scripts/branch-guard.sh is the source of truth, and scripts/install-branch-guard.sh provides idempotent installation for non-Homebrew users (copy + settings.json registration via jq). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- test_branch_guard_e2e.sh: 31 automated e2e tests covering full workflows, bypass lifecycle, config cascade, error messages, cross-tool consistency, dry-run, performance, and real-world scenarios - test_branch_guard_interactive.sh: 10 human-guided QA scenarios for user-facing behavior (formatting, registration, commands) - tests/cli/README.md: document both new test suites Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace grep/sed extract_json_string with jq-based _json_get (Python fallback, grep/sed last resort) - Validate config JSON before parsing; malformed config falls through to auto-detect with warning - Use proper jq paths (.tool_input.file_path) instead of flat key search - Remove ORCHESTRATE from tracking, add to .gitignore - Fix "session-scoped" bypass claims — marker persists until re-enabled via /craft:git:protect - Fix test configs: flat top-level keys match hook's schema - All 79 automated tests passing (42 unit + 31 e2e + 6 integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- check.md: show only current branch's guard status (not both) - protect.md: detect actual protection level dynamically, verify hook is installed before reporting status - status.md: switch grep/sed JSON parsing to jq for bypass marker and config file reads - worktree.md: add belt-and-suspenders comment for main block - tests/cli/README.md: fix test counts (42→49 unit, 7→6 integ, ~30→31 e2e) - test_branch_guard.sh: add 7 edge case tests (Group 10): path traversal, symlinks, special branch names (slash+dot), git -C limitation, malformed config warning, .STATUS files, .R extension Tests: 86 automated (49 unit + 31 e2e + 6 integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve conflicts: combine 108 commands (branch-protection) with teaching-ecosystem test counts (1294 base + 86 branch-guard = 1380). Deduplicate .gitignore working artifact patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8 tasks
Data-Wise
added a commit
that referenced
this pull request
Feb 7, 2026
* chore: update .STATUS for v2.15.0 release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: sync site pages for v2.15.0 (version refs, test counts, changelog) - REFCARD: version 2.14.0→2.15.0, tests 1248→1286, feature highlight - CHANGELOG: add v2.15.0 entry (spec simplification + smart questions) - claude-md.md: version ref 2.14.0→2.15.0 - first-10-minutes tutorial: version in example output - TEST-CONVENTIONS, cookbook, check-mastery: test count 1248→1286 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS with site deploy completion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add branch protection and teaching ecosystem specs Two design specs from brainstorm sessions: - Branch protection hooks (PreToolUse enforcement for dev/main) - Teaching ecosystem coordination (Craft + Scholar + Flow-CLI) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS for v2.16.0 feature branches Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: teaching ecosystem coordination (#57) * docs: revise teaching ecosystem spec with brainstorm decisions - Add 10 design decisions from deep brainstorm session - Replace assumed config examples with real stat-545 data - Remove shell alias references (not needed for craft) - Add deployment/branches normalization - Expand test cases from 6 to 8 - Add ORCHESTRATE implementation plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: normalize flow-cli config schema for teaching ecosystem Add _normalize_config() adapter that silently maps flow-cli's schema (semester_info, course.name, branches) to craft-native format (dates, course.number, deployment). Fix break validation to allow single-day breaks (start == end). Fix broken test import and add 8 normalization tests. - teach_config.py: _normalize_config() with setdefault() merge pattern - teach_config.py: break validation >= changed to > (MLK Day fix) - test_integration_teaching_workflow.py: fix import, add TestConfigNormalization - teaching-workflow.md: add ecosystem section with role boundaries Spec: docs/specs/SPEC-teaching-ecosystem-coordination-2026-02-06.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update config schema and tutorial for teaching ecosystem - teaching-config-schema.md: add flow-cli compatibility section with field mapping table, design principles, and example config. Document single-day break support. Add schema changelog v1.1 entry. Update validation errors table. - teaching-mode-setup.md: add flow-cli compatibility note, single-day break example, link to ecosystem guide. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add dedicated Teaching tab to documentation site Add top-level Teaching navigation tab with ecosystem-aware landing page. Teaching was previously a subsection under Guides — now it's a first-class section with its own hub page showing the three-tool ecosystem (flow-cli, Scholar, Craft), decision guide, config compatibility table, and links to all teaching resources. - docs/teaching/index.md: new landing page with grid cards, ecosystem overview, command reference, config compatibility summary - mkdocs.yml: new Teaching tab (section 3), removed old Teaching Mode subsection from Guides, renumbered remaining sections Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: sync site pages for teaching ecosystem (test counts, changelog, status) - Update test counts 1286 → 1294 across 8 files (CLAUDE.md, README, REFCARD, etc.) - Add [Unreleased] changelog section for teaching ecosystem coordination - Update .STATUS with implementation complete status - Update mkdocs.yml site description with teaching ecosystem note Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review issues (ORCHESTRATE, spec status, normalizer) - Remove ORCHESTRATE from tracking and add to .gitignore - Update spec status from Draft to Implemented (craft-side) - Use setdefault() for course dict to match dates/deployment pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * chore: post-merge site sync — .STATUS, spec count, cleanup - Update .STATUS for teaching ecosystem merge (PR #57) - Fix spec count 24 → 23 in CLAUDE.md (3 occurrences) - Remove orphaned WAVE3-AGENT1-SUMMARY.md - Remove 6 tracked brainstorm files (dir is gitignored) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix stale test count and remove 49 orphaned working artifacts - Fix init.md test count 1174 → 1294, version v2.12.0 → v2.15.0 - Remove 49 orphaned root .md files (WAVE*, PHASE*, IMPLEMENTATION*, WIP*, POST-MERGE*, reports, old release notes, proposals) - Add .gitignore patterns to prevent future accumulation - Kept: README, CLAUDE, CONTRIBUTING, ROADMAP, AGENTS, RELEASE-v2.8.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update guides, refcards, and tutorials for teaching ecosystem - integration-testing.md: Teaching 8→16 tests, total 27→38, update expected output and test descriptions - REFCARD-TEACHING.md: Add flow-cli config compatibility section with field mapping table and single-day break note - deploy-course-website.md: Add flow-cli config compatibility tip - teaching-migration.md: Add note for existing flow-cli users to skip config creation step - check-command-mastery.md: Integration tests 27→38 - CLAUDE.md: Teaching tests 8→16, total integration 36→47 - Remove 6 orphaned docs files (gap analysis, lint baseline, session summaries, implementation summary) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: branch protection hooks (v2.16.0) (#58) * feat: add branch protection hooks and craft command enhancements Implement deterministic branch protection via PreToolUse hook that prevents destructive edits on protected branches, addressing advisory CLAUDE.md rules failing under reasoning pressure. Hook: ~/.claude/hooks/branch-guard.sh (~290 lines) - main = block-all (no edits, writes, or commits) - dev = block-new-code (new code files blocked, fixups/md/tests OK) - feature/* = unrestricted - Per-project config via .claude/branch-guard.json - Auto-detect repos with dev branch - Session-scoped bypass with reason logging New commands: /craft:git:unprotect, /craft:git:protect Enhanced: /craft:check, /craft:do, /craft:git:worktree, /craft:git:status Tests: 42 unit (bash) + 6 integration (python), all passing Performance: ~60ms/invocation (under 100ms target) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: move branch-guard hook into repo with standalone installer The branch-guard.sh hook previously lived at ~/.claude/hooks/ outside version control. Now scripts/branch-guard.sh is the source of truth, and scripts/install-branch-guard.sh provides idempotent installation for non-Homebrew users (copy + settings.json registration via jq). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add branch guard e2e and interactive test suites - test_branch_guard_e2e.sh: 31 automated e2e tests covering full workflows, bypass lifecycle, config cascade, error messages, cross-tool consistency, dry-run, performance, and real-world scenarios - test_branch_guard_interactive.sh: 10 human-guided QA scenarios for user-facing behavior (formatting, registration, commands) - tests/cli/README.md: document both new test suites Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS — branch protection complete (9/9 steps) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update command count 106 → 108 (added unprotect + protect) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: gitignore test CLI logs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: switch branch-guard JSON parsing to jq, address PR review - Replace grep/sed extract_json_string with jq-based _json_get (Python fallback, grep/sed last resort) - Validate config JSON before parsing; malformed config falls through to auto-detect with warning - Use proper jq paths (.tool_input.file_path) instead of flat key search - Remove ORCHESTRATE from tracking, add to .gitignore - Fix "session-scoped" bypass claims — marker persists until re-enabled via /craft:git:protect - Fix test configs: flat top-level keys match hook's schema - All 79 automated tests passing (42 unit + 31 e2e + 6 integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address remaining PR review items - check.md: show only current branch's guard status (not both) - protect.md: detect actual protection level dynamically, verify hook is installed before reporting status - status.md: switch grep/sed JSON parsing to jq for bypass marker and config file reads - worktree.md: add belt-and-suspenders comment for main block - tests/cli/README.md: fix test counts (42→49 unit, 7→6 integ, ~30→31 e2e) - test_branch_guard.sh: add 7 edge case tests (Group 10): path traversal, symlinks, special branch names (slash+dot), git -C limitation, malformed config warning, .STATUS files, .R extension Tests: 86 automated (49 unit + 31 e2e + 6 integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * docs: sync site pages for branch protection merge (108 cmds, 1380 tests) - Update command count 106 → 108 across 3 files - Update test count 1294 → 1380 across 7 files - Add protect/unprotect to mkdocs.yml nav and git.md category page - Add branch protection entry to CHANGELOG.md unreleased section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix remaining stale refs and add branch-protection to nav - init.md template: 106→108 commands, 1294→1380 tests - mkdocs.yml: add branch-protection spec to Specifications nav - overview.md: add protect/unprotect to git commands list - REFCARD.md: add protect/unprotect to git commands table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: archive all 23 completed specs to docs/specs/_archive/ Move all spec files to _archive/ since all features are released. Update active references in commands, CLAUDE.md, mkdocs.yml nav, and CHANGELOG. Historical references (version history, old changelogs) left as-is for accuracy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add branch protection to architecture, tutorials, and integration guide - architecture.md: add PreToolUse hook section with protection levels - TUTORIAL-worktree-setup.md: add branch-guard tip after safety warning - integration-testing.md: add Category 4 (branch guard, 6 tests), update totals 38→44, add to key files reference table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add 52 branch-guard dogfooding tests (1380 → 1432) New test file tests real craft repo (not temp repos): - Hook installation & registration (7 tests) - Craft repo dogfooding on dev branch (11 tests) - Real Claude Code payload formats (10 tests) - Extension classification coverage (16 tests) - Error message formatting (5 tests) - Performance benchmarks (2 tests) - Bypass marker lifecycle (1 test) - Dry-run mode (1 test) Also fixed dangling symlink: hook pointed to deleted worktree, repointed to main repo copy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: prepare v2.16.0 release - Bump version: 2.15.0 → 2.16.0 (plugin.json, CLAUDE.md, README, REFCARD) - Update CHANGELOG: [Unreleased] → [2.16.0] - 2026-02-07 - Fix 12 broken links from spec archival (missed _archive/ prefix) - Add archived specs to .linkcheck-ignore (frozen docs, stale refs expected) - Fix dead IMPLEMENTATION-SUMMARY reference in REFCARD-DOCS-UPDATE - Add DRY-RUN-SUMMARY historical ref to .linkcheck-ignore - All 13 core tests passing, pre-release check green Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove brainstorm gitignore and linkcheck entries The docs/brainstorm/ directory was empty (never had tracked files). Removed the gitignore entry and the corresponding .linkcheck-ignore category since there's nothing to ignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Data-Wise
added a commit
that referenced
this pull request
Feb 7, 2026
* chore: update .STATUS for v2.15.0 release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: sync site pages for v2.15.0 (version refs, test counts, changelog) - REFCARD: version 2.14.0→2.15.0, tests 1248→1286, feature highlight - CHANGELOG: add v2.15.0 entry (spec simplification + smart questions) - claude-md.md: version ref 2.14.0→2.15.0 - first-10-minutes tutorial: version in example output - TEST-CONVENTIONS, cookbook, check-mastery: test count 1248→1286 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS with site deploy completion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add branch protection and teaching ecosystem specs Two design specs from brainstorm sessions: - Branch protection hooks (PreToolUse enforcement for dev/main) - Teaching ecosystem coordination (Craft + Scholar + Flow-CLI) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS for v2.16.0 feature branches Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: teaching ecosystem coordination (#57) * docs: revise teaching ecosystem spec with brainstorm decisions - Add 10 design decisions from deep brainstorm session - Replace assumed config examples with real stat-545 data - Remove shell alias references (not needed for craft) - Add deployment/branches normalization - Expand test cases from 6 to 8 - Add ORCHESTRATE implementation plan Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: normalize flow-cli config schema for teaching ecosystem Add _normalize_config() adapter that silently maps flow-cli's schema (semester_info, course.name, branches) to craft-native format (dates, course.number, deployment). Fix break validation to allow single-day breaks (start == end). Fix broken test import and add 8 normalization tests. - teach_config.py: _normalize_config() with setdefault() merge pattern - teach_config.py: break validation >= changed to > (MLK Day fix) - test_integration_teaching_workflow.py: fix import, add TestConfigNormalization - teaching-workflow.md: add ecosystem section with role boundaries Spec: docs/specs/SPEC-teaching-ecosystem-coordination-2026-02-06.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update config schema and tutorial for teaching ecosystem - teaching-config-schema.md: add flow-cli compatibility section with field mapping table, design principles, and example config. Document single-day break support. Add schema changelog v1.1 entry. Update validation errors table. - teaching-mode-setup.md: add flow-cli compatibility note, single-day break example, link to ecosystem guide. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add dedicated Teaching tab to documentation site Add top-level Teaching navigation tab with ecosystem-aware landing page. Teaching was previously a subsection under Guides — now it's a first-class section with its own hub page showing the three-tool ecosystem (flow-cli, Scholar, Craft), decision guide, config compatibility table, and links to all teaching resources. - docs/teaching/index.md: new landing page with grid cards, ecosystem overview, command reference, config compatibility summary - mkdocs.yml: new Teaching tab (section 3), removed old Teaching Mode subsection from Guides, renumbered remaining sections Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: sync site pages for teaching ecosystem (test counts, changelog, status) - Update test counts 1286 → 1294 across 8 files (CLAUDE.md, README, REFCARD, etc.) - Add [Unreleased] changelog section for teaching ecosystem coordination - Update .STATUS with implementation complete status - Update mkdocs.yml site description with teaching ecosystem note Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address review issues (ORCHESTRATE, spec status, normalizer) - Remove ORCHESTRATE from tracking and add to .gitignore - Update spec status from Draft to Implemented (craft-side) - Use setdefault() for course dict to match dates/deployment pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * chore: post-merge site sync — .STATUS, spec count, cleanup - Update .STATUS for teaching ecosystem merge (PR #57) - Fix spec count 24 → 23 in CLAUDE.md (3 occurrences) - Remove orphaned WAVE3-AGENT1-SUMMARY.md - Remove 6 tracked brainstorm files (dir is gitignored) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix stale test count and remove 49 orphaned working artifacts - Fix init.md test count 1174 → 1294, version v2.12.0 → v2.15.0 - Remove 49 orphaned root .md files (WAVE*, PHASE*, IMPLEMENTATION*, WIP*, POST-MERGE*, reports, old release notes, proposals) - Add .gitignore patterns to prevent future accumulation - Kept: README, CLAUDE, CONTRIBUTING, ROADMAP, AGENTS, RELEASE-v2.8.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update guides, refcards, and tutorials for teaching ecosystem - integration-testing.md: Teaching 8→16 tests, total 27→38, update expected output and test descriptions - REFCARD-TEACHING.md: Add flow-cli config compatibility section with field mapping table and single-day break note - deploy-course-website.md: Add flow-cli config compatibility tip - teaching-migration.md: Add note for existing flow-cli users to skip config creation step - check-command-mastery.md: Integration tests 27→38 - CLAUDE.md: Teaching tests 8→16, total integration 36→47 - Remove 6 orphaned docs files (gap analysis, lint baseline, session summaries, implementation summary) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: branch protection hooks (v2.16.0) (#58) * feat: add branch protection hooks and craft command enhancements Implement deterministic branch protection via PreToolUse hook that prevents destructive edits on protected branches, addressing advisory CLAUDE.md rules failing under reasoning pressure. Hook: ~/.claude/hooks/branch-guard.sh (~290 lines) - main = block-all (no edits, writes, or commits) - dev = block-new-code (new code files blocked, fixups/md/tests OK) - feature/* = unrestricted - Per-project config via .claude/branch-guard.json - Auto-detect repos with dev branch - Session-scoped bypass with reason logging New commands: /craft:git:unprotect, /craft:git:protect Enhanced: /craft:check, /craft:do, /craft:git:worktree, /craft:git:status Tests: 42 unit (bash) + 6 integration (python), all passing Performance: ~60ms/invocation (under 100ms target) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: move branch-guard hook into repo with standalone installer The branch-guard.sh hook previously lived at ~/.claude/hooks/ outside version control. Now scripts/branch-guard.sh is the source of truth, and scripts/install-branch-guard.sh provides idempotent installation for non-Homebrew users (copy + settings.json registration via jq). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add branch guard e2e and interactive test suites - test_branch_guard_e2e.sh: 31 automated e2e tests covering full workflows, bypass lifecycle, config cascade, error messages, cross-tool consistency, dry-run, performance, and real-world scenarios - test_branch_guard_interactive.sh: 10 human-guided QA scenarios for user-facing behavior (formatting, registration, commands) - tests/cli/README.md: document both new test suites Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS — branch protection complete (9/9 steps) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update command count 106 → 108 (added unprotect + protect) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: gitignore test CLI logs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: switch branch-guard JSON parsing to jq, address PR review - Replace grep/sed extract_json_string with jq-based _json_get (Python fallback, grep/sed last resort) - Validate config JSON before parsing; malformed config falls through to auto-detect with warning - Use proper jq paths (.tool_input.file_path) instead of flat key search - Remove ORCHESTRATE from tracking, add to .gitignore - Fix "session-scoped" bypass claims — marker persists until re-enabled via /craft:git:protect - Fix test configs: flat top-level keys match hook's schema - All 79 automated tests passing (42 unit + 31 e2e + 6 integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: address remaining PR review items - check.md: show only current branch's guard status (not both) - protect.md: detect actual protection level dynamically, verify hook is installed before reporting status - status.md: switch grep/sed JSON parsing to jq for bypass marker and config file reads - worktree.md: add belt-and-suspenders comment for main block - tests/cli/README.md: fix test counts (42→49 unit, 7→6 integ, ~30→31 e2e) - test_branch_guard.sh: add 7 edge case tests (Group 10): path traversal, symlinks, special branch names (slash+dot), git -C limitation, malformed config warning, .STATUS files, .R extension Tests: 86 automated (49 unit + 31 e2e + 6 integration) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * docs: sync site pages for branch protection merge (108 cmds, 1380 tests) - Update command count 106 → 108 across 3 files - Update test count 1294 → 1380 across 7 files - Add protect/unprotect to mkdocs.yml nav and git.md category page - Add branch protection entry to CHANGELOG.md unreleased section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix remaining stale refs and add branch-protection to nav - init.md template: 106→108 commands, 1294→1380 tests - mkdocs.yml: add branch-protection spec to Specifications nav - overview.md: add protect/unprotect to git commands list - REFCARD.md: add protect/unprotect to git commands table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: archive all 23 completed specs to docs/specs/_archive/ Move all spec files to _archive/ since all features are released. Update active references in commands, CLAUDE.md, mkdocs.yml nav, and CHANGELOG. Historical references (version history, old changelogs) left as-is for accuracy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add branch protection to architecture, tutorials, and integration guide - architecture.md: add PreToolUse hook section with protection levels - TUTORIAL-worktree-setup.md: add branch-guard tip after safety warning - integration-testing.md: add Category 4 (branch guard, 6 tests), update totals 38→44, add to key files reference table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add 52 branch-guard dogfooding tests (1380 → 1432) New test file tests real craft repo (not temp repos): - Hook installation & registration (7 tests) - Craft repo dogfooding on dev branch (11 tests) - Real Claude Code payload formats (10 tests) - Extension classification coverage (16 tests) - Error message formatting (5 tests) - Performance benchmarks (2 tests) - Bypass marker lifecycle (1 test) - Dry-run mode (1 test) Also fixed dangling symlink: hook pointed to deleted worktree, repointed to main repo copy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: prepare v2.16.0 release - Bump version: 2.15.0 → 2.16.0 (plugin.json, CLAUDE.md, README, REFCARD) - Update CHANGELOG: [Unreleased] → [2.16.0] - 2026-02-07 - Fix 12 broken links from spec archival (missed _archive/ prefix) - Add archived specs to .linkcheck-ignore (frozen docs, stale refs expected) - Fix dead IMPLEMENTATION-SUMMARY reference in REFCARD-DOCS-UPDATE - Add DRY-RUN-SUMMARY historical ref to .linkcheck-ignore - All 13 core tests passing, pre-release check green Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove brainstorm gitignore and linkcheck entries The docs/brainstorm/ directory was empty (never had tracked files). Removed the gitignore entry and the corresponding .linkcheck-ignore category since there's nothing to ignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update .STATUS for v2.16.0 release Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update index.md for v2.16.0 (108 commands, git 13, latest release) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add protect/unprotect command reference pages Resolves mkdocs nav warnings for missing command docs. These pages document the v2.16.0 branch protection commands. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
scripts/branch-guard.sh) — PreToolUse hook enforcing branch protection (main=block-all, dev=block-new-code, feature=unrestricted)scripts/install-branch-guard.sh) — copies hook + registers in settings.json (idempotent, uses jq)/craft:git:unprotect(session-scoped bypass) +/craft:git:protect(re-enable)/craft:check(branch context),/craft:do(branch-aware routing),/craft:git:worktree(main block),/craft:git:status(guard indicator).claude/branch-guard.json(optional, supports any branch name)Tests
test_branch_guard.sh)test_branch_guard_e2e.sh)test_integration_branch_guard.py)test_branch_guard_interactive.sh)Test plan
bash tests/test_branch_guard.sh— 42 unit testsbash tests/test_branch_guard_e2e.sh— 31 e2e testspython3 tests/test_integration_branch_guard.py— 6 integration tests./scripts/validate-counts.sh— command counts match (108)npx markdownlint-cli2 "**/*.md"— 0 errors (431 files)python3 tests/test_craft_plugin.py— all core tests passing🤖 Generated with Claude Code